Modifications for the following issues: #46, #47, #48