added major parts of functionality