Reformated the code for #39
Further worked on revision to #39