All functions now private (except main)