Refactored; API changed