Fixed Issue #14, started Issue #10, general bug fixes