Code cleanup and changed the input methods so they become more bullet-proff