move phy wriring code to separate class