Fixed input and added documentation