fixing the constants errors by creating object and running function afterwards.