completely changed for static usage and better documentation added