Changed to chaining and added some phpdoc