First go at updateState function
Added bound calculation to updateState