restructred directory
added checking