Added drawing and fixed bugs