Changed naming and code structure