cleanup code
do code more portable