changed return type to Map
some small fixes