Fixed some implementation and code was cleaned up