Updates to code to make it more responsive