some updates, negative index prevention
removed unused classes