Changed some parameters. Made a bit nicer code on last commit and added documentation.