Added new facilities and made a little refactoring

I will do something more tomorrow, maybye we should make differen class
for useful functions...