Just some bug fixes..

Working on a full rewrite