deleted redundant function
removed redundant function and cleaned up code, fixed bug
fixed bug and improved code