Removed constructor side effect and consolidated constructor code.