No proper exception handling. Untidy code.

Didn't add proper exception handling yet. Not errors-free.