made the whitespace more traditional
made take tail recursive
removed platten one, replaced it with