move map related function to map controller