reindent for better readability
simplify restructure reduce fn
fix indent