minor code improvements, remove unneeded code