bug fixes. Will add documentation next