cleaning up and adding windowid function