took some code from another project for the base