Helped to fix enter key, modifying function to work with it aswell