Make wake-on-LAN and optimised some code