[[ Bug 11242 ]] Cleaned up code a bit and added referencing comments.