Some fixes and getting rid of unecessary functions.