Changed style

And fixed several bugs.