adding documentation, tested complete script