refactored code and finished sending functionality. Will begin testing and merge