Refactor away globals by reducing scope to that needed and removing some unused variables. Lower decoder max time from 300 to 100.