Mercury branch - all the changes and functionality we need to have Mercury skin working

DO NOT MERGE, THIS PR IS PART OF PROJECT MERCURY! 
I think this should be two separate functions. Let one function do one thing only. And the part inside "else" doesn't match with the function name.