fixing indention. m(
reordered functions to make merging easier