extracted common js methods