improve by add arguments to function rather than fixed varaible