Code reformat, add method hasElement()