Now passes 14 cases. Added an owned_locks varible to thread and also a stack which is commented out in functions where it could be used