removed more unnecessary code
updated version