Implement #3, #12, bug fixes