reformatted code, continued adding gravmap functionality