edited code

added additional functionality, began working on formatting