slightly cleanup the code