Re-wrote for any C class network