Fix #55
Remove duplicate code