fixed bug, removed redundancy