added bunch of code, loops etc.