moved validate to constructor