add macros
modify sleep logic