Edited the body of the popover and refactored some methods.