ADD first version basic functions
MOD some refactoring
ADD some helpful functions
ADD some comments