Refactored code and added Species functionality