added comments and some minor refactoring
fixed merging conflicts and fallback for rgba()