changed return type, some cleanup