Modified creating purchase functionality and added viewing functionality