added some code from old projects