solidfied the use of _state and baseUrl; some code cleanup