fixed bug and removed redundant code