refactor led functions