There's a lot going on in this method. Is there any way to decompose it a lil?