add constructor
slight refactor