cleanup code and remove unneeded code