refactored and added more methods