Added functionality for checking input and storing values