refactored and added plist support