#22 bugfix, delete dublicate code