Fixed input refresh issue; added tests