just a few modification to fit my needs