Refactored and moved from private repository