Closes #5
Close #5 and significantly reduce and simplify code