Refactoring

Fix #5 and #6 issue, but need more refactoring