removed unnecessary code, got rid of flag