Fixed self contained path issue and moved all checks to a single location