Resolved #6

Various bug fixes.