cleaned up functions and added a displayword function