refactored study related code