Cleaning up a lot of code

Signed-off-by: Yuri Tománek <yuri@tomanek.com.au>