refactor, and added some enemy function