Adding test cases and simplifying REST API