fixed script for ease of integration