Restructuring and better param handling