cleaned up some code + removed debugging asserts