Updates Privly-Applications and Removes Duplicated Code

The title says it all.