move remote-codes to reusable header-file, fix compiler warnings