Improved the API Handlers and modulaized it.