Changed main and program behaviour