added with_power function, cleaned up sleep loop in main