Added comments. Made line array declaration dynamic.