simplifying constructor and adding documentation