Add argumented constructor and fix bug