Fixed some bug and refactored a little. Installed basic parameter assertions.