removed redundant if-else branches. Close #56.