Implement and fix bug