implemented constructor for main object