move parsing code to seperate class
fixes selection bug