Cleaned up cast lock, actually working now