Added constructors where appropriate and adjusted the example