added instructions and refactored