refactored for better RESTful API